package com.gxuwz.easyschool.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.gxuwz.easyschool.R;
import com.gxuwz.easyschool.holder.NewsBulletinHolder;
import com.gxuwz.easyschool.holder.TradeQueryHolder;

public class TradeQueryAdapter extends BaseAdapter {
    private String[] places = {"第三食堂二楼学校食堂"};
    private String[] orders = {"交易流水号：11237193"};
    private String[] times = {"交易时间：12-08 14:11:14"};
    private String[] moneys = {"-11"};
    private String[] types = {"商务收费"};
    private Context context;
    public TradeQueryAdapter(Context context){
        this.context = context;
    }

    @Override
    public int getCount() {
        return places.length;
    }

    @Override
    public Object getItem(int position) {
        return places[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TradeQueryHolder tradeQueryHolder = null;
        if(convertView == null){
            convertView = LayoutInflater.from(context).inflate(R.layout.trade_query_list,null);
            tradeQueryHolder = new TradeQueryHolder();
            tradeQueryHolder.setTrade_query_place(convertView.findViewById(R.id.trade_query_place));
            tradeQueryHolder.setTrade_query_order(convertView.findViewById(R.id.trade_query_order));
            tradeQueryHolder.setTrade_query_time(convertView.findViewById(R.id.trade_query_time));
            tradeQueryHolder.setGetTrade_query_money(convertView.findViewById(R.id.trade_query_money));
            tradeQueryHolder.setGetTrade_query_type(convertView.findViewById(R.id.trade_query_type));
            tradeQueryHolder.setTrade_query_pic(convertView.findViewById(R.id.trade_query_pic));
            convertView.setTag(tradeQueryHolder);
        } else {
            tradeQueryHolder = (TradeQueryHolder) convertView.getTag();
        }
        tradeQueryHolder.getTrade_query_place().setText(places[position]);
        tradeQueryHolder.getTrade_query_order().setText(orders[position]);
        tradeQueryHolder.getTrade_query_time().setText(times[position]);
        tradeQueryHolder.getGetTrade_query_money().setText(moneys[position]);
        tradeQueryHolder.getGetTrade_query_type().setText(types[position]);
        tradeQueryHolder.getTrade_query_pic().setBackgroundResource(R.drawable.picture);
        return convertView;
    }
}
